package com.common.global;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author johnny
 * @create 2021-05-14 3:48 下午
 **/
@Data
@NoArgsConstructor
public class BizException extends RuntimeException {
    /**
     * 错误码
     */
    protected String errorCode;
    /**
     * 错误信息
     */
    protected String errorMsg;


    public BizException(String errorCode, String errorMsg) {
        super(errorCode);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BizException(BaseErrorInterface commonEnum) {
        super(commonEnum.getResultCode());
        this.errorCode = commonEnum.getResultCode();
        this.errorMsg = commonEnum.getResultMsg();
    }

}